<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .style {
            text-decoration: red line-through;
        }
    </style>
</head>

<body>
    <input type="text" id="box">
    <input type="submit" value="获取信息">
    <ol></ol>
    <script>
        let box = document.getElementById('box');
        let image = document.querySelector('[value="获取信息"]');
        let ol = document.querySelector('ol');
        image.onclick = function () {
            if (box.value) {
                let li = document.createElement('li');
                li.innerHTML = box.value;
                box.value = '';
                ol.appendChild(li);
            }
            foo()
        }

        function foo() {
            for (let item of ol.children) {
                item.onclick = function () {
                    item.classList.toggle('style')
                }
            }
        }
        foo()
    </script>
</body>

</html>